
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_pleasure_video/constant/color.dart';
import 'package:flutter_pleasure_video/constant/style.dart';
import 'package:flutter_pleasure_video/route/router.dart';
import 'package:flutter_pleasure_video/widget/common/app_icon_button.dart';
import 'package:flutter_pleasure_video/widget/common/custom_appbar.dart';
import 'package:get/get.dart';

class AddSourcePage extends StatelessWidget {
  const AddSourcePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        titleString: "添加资源",
        actions: [
          CustomAppBarIconButton(
              icon: Icons.history_outlined,
              iconColor: AppColor.black,
              onTap: () {
                AppRouter.toResourcesDescriptionPage();
              }),
        ],
      ),
      body: Container(
        width: Get.width,
        height: Get.height,
        padding: const EdgeInsets.symmetric(vertical: 50,horizontal: 32),
        color: AppColor.bgWhite,
        child: _getCustomScrollView(),
      ),
    );
  }


  Widget _getCustomScrollView(){
    return SingleChildScrollView(
      child: Column(
        children: [
          _getTextEditWidget("title:"),
          _getTextEditWidget("url:"),
          _getTextEditWidget("search url:"),
          _getTextEditWidget("search page rule:"),
          _getTextEditWidget("detail page rule:"),
          Container(
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                TextButton(onPressed: (){}, child: Text('重置'),style: ButtonStyle(backgroundColor:MaterialStateProperty.all(Colors.blue)),),
                TextButton(onPressed: (){}, child: Text('确定'),style: ButtonStyle(backgroundColor:MaterialStateProperty.all(Colors.blue)),)
              ],
            ),
          ),
        ],
      ),
    );
  }


  Widget _getTextEditWidget(String title){
    return Container(
      child: Row(
        children: [
          Text(title,style: AppStyle.textRegular24),
          SizedBox(width: 8),
          Expanded(child: SizedBox(child: Container(
            decoration: BoxDecoration(
              border: Border(bottom: BorderSide(width: 1,color: AppColor.textHint))
            ),
            child: Text(" ",style: AppStyle.textRegular22),
          ))),
          AppIconButton(
            iconSize: 20,
            icon: Icons.history_outlined,
            iconColor:AppColor.textHint,
            buttonHeight: 32,
            buttonWidth: 32,
          ),
        ],
      ),
    );
  }

}
